package com.baichen.bio;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class BioServer {
    public static void main(String[] args) throws IOException {
        try (ServerSocket serverSocket = new ServerSocket(8888)) {
            while (true) {
                Socket accept = serverSocket.accept();
                InputStream inputStream = accept.getInputStream();
                byte[] buffer = new byte[1024];
                int readLength;
                while ((readLength = inputStream.read(buffer)) != -1) {
                    System.out.println(new String(buffer, 0, readLength));
                }
            }
        }
    }
}
